#include<iostream>
using namespace std;
#include<string>

class Solution
{
public:
    int calNum(const string& s) {
        return process(s,0);
    }
    //0~i-1已经完成统计 统计之后的可能性 i~s.length()-1
    int process(const string& s,int i) {
        if(i > s.length()) {
            //两次越界 不做统计
            return 0;
        }
        if(i == s.length()) {
            //没有字母了
            prints(s,i);
            cout << "\tno alphabet return 1" << endl;
            return 1;
        }
        if(s[i] == '0') {
            //0x不作统计
            prints(s,i);
            cout << "\tinvalid convert return 0" << endl;
            return 0;
        } else if(s[i] == '1' || (s[i] == '2' && s[i+1] <= '6')) {
            //s[i]单独转换+s[i]和s[i+1]共同转换
            prints(s,i);
            cout << "\t1x or 2y y<=6" << endl;
            return process(s,i+1) + process(s,i+2);
        } else {
            //s[i]单独转化
            prints(s,i);
            cout << "\tsignal convert" << endl;
            return process(s,i+1);
        }
    }

    void prints(const string& s,int i) {
        cout << "cur word:";
        for(int k=i; k<s.length(); k++) {
            cout << s[k];
        }
        cout << endl;
    }
};

int main() {
    // int ret = Solution().calNum("111");
    int ret = Solution().calNum("7210231231232031203123");
    cout << "ret:" << ret << endl;
    return 0;
}